package com.insist.controller;

import com.insist.entity.TestEntity;
import com.insist.service.TestService;
import com.insist.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2016/6/28.
 */
@Controller
public class TestController {

    @Autowired
    private TestService testService;

    @RequestMapping("/test")
    @ResponseBody
    public String test(Long id){
        TestEntity entity=testService.get(id);
        return entity.toString();
    }
    @RequestMapping("/save")
    @ResponseBody
    public String save(String name){
        TestEntity entity=new TestEntity();
        entity.setName(name);
        testService.save(entity);
        return "succes";
    }
    @RequestMapping("/testFind")
    @ResponseBody
    public String testFind(Long id){
        return testService.testFind(id);
    }

    @RequestMapping("/testData")
    @ResponseBody
    public String testData(String name){
        System.out.println("我是一个好人");
        return "我是一个好人";
    }


    @Autowired
    private UserService userService;

    @RequestMapping("/test/resetPassword")
    @ResponseBody
    public String resetPassword(String mobile){
        userService.resetPassword(mobile);
        return "重置成功";
    }


    @RequestMapping("/test/addCoin")
    @ResponseBody
    public String addCoin(String mobile){
        userService.testAddCoin(mobile);
        return "撒币成功";
    }



}
